#pragma once
#include "spdlog/spdlog.h"

#include <memory>
#include <string>
#include <QString>
#include <QtCore/qglobal.h>

#ifndef BUILD_STATIC
# if defined(CLOGLIBRARY_LIB)
#  define CLOGLIBRARY_EXPORT Q_DECL_EXPORT
# else
#  define CLOGLIBRARY_EXPORT Q_DECL_IMPORT
# endif
#else
# define CLOGLIBRARY_EXPORT
#endif



#define LOG_GETINSTANCE CLogWarpper::GetInstance()

class CLogWarpper
{
public:
	static CLogWarpper* GetInstance();
	void InitLog(std::string logger_name, std::string file_name,bool multi_thread=true,bool debug_flag=true,bool info_flag=true);
	
	void WriteDebugLog(QStringView log);
	void WriteInfoLog(QStringView log);
private:
	auto GetLogger();
	CLogWarpper();
	~CLogWarpper();
	CLogWarpper(const CLogWarpper&) = delete;
	CLogWarpper(const CLogWarpper&&) = delete;
	CLogWarpper& operator=(const CLogWarpper&) = delete;
	CLogWarpper& operator=(const CLogWarpper&&) = delete;
private:
	std::shared_ptr<spdlog::logger> m_logger;
	bool m_debug_flag;
	bool m_info_flag;
};

